VelocityTrackerCompat

Helper for accessing features in VelocityTracker.

Types

Functions

Link copied to clipboard
open fun addMovement(@NonNull tracker: VelocityTracker, @NonNull event: MotionEvent)
Add a user's movement to the tracker.
Link copied to clipboard
open fun clear(@NonNull tracker: VelocityTracker)
Reset the velocity tracker back to its initial state.
Link copied to clipboard
open fun computeCurrentVelocity(@NonNull tracker: VelocityTracker, units: Int)
Equivalent to invoking computeCurrentVelocity with a maximum velocity of Float.MAX_VALUE.
open fun computeCurrentVelocity(@NonNull tracker: VelocityTracker, units: Int, maxVelocity: Float)
Compute the current velocity based on the points that have been collected.
Link copied to clipboard
open fun getAxisVelocity(@NonNull tracker: VelocityTracker, axis: Int): Float
Equivalent to calling getAxisVelocity for axis and the active pointer.
open fun getAxisVelocity(@NonNull tracker: VelocityTracker, axis: Int, pointerId: Int): Float
Retrieve the last computed velocity for a given motion axis.
Link copied to clipboard
open fun getXVelocity(tracker: VelocityTracker, pointerId: Int): Float
Link copied to clipboard
open fun getYVelocity(tracker: VelocityTracker, pointerId: Int): Float
Link copied to clipboard
open fun isAxisSupported(@NonNull tracker: VelocityTracker, axis: Int): Boolean
Checks whether a given velocity-trackable MotionEvent axis is supported for velocity tracking by this VelocityTracker instance (refer to getAxisVelocity for a list of potentially velocity-trackable axes).
Link copied to clipboard
open fun recycle(@NonNull tracker: VelocityTracker)
Return a VelocityTracker object back to be re-used by others.